package com.mengma.controller;

import com.mengma.dao.ProductMapper;
import com.mengma.entity.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/test")
@RestController
public class TestSelect {
    @Autowired
    ProductMapper productMapper;
    @RequestMapping(value = "select")
    public String test(){
        Product product = productMapper.selectByPname("37");
        return product.toString();
    }
    @PostMapping(value = "selectsql")
    public String Selectsql(@RequestBody Product product){
        Product productSelect=productMapper.DynamicSQL(product);
        return productSelect.toString();
    }

}
